local BattleSceneLoader = {}


function BattleSceneLoader.loadBg(name)
	local res = UnityEngine.Resources.Load(name)
	local gameObject = UnityEngine.GameObject.Instantiate(res)
	local transform = gameObject:GetComponent(typeof(UnityEngine.Transform))
	--transform.localPosition = Vector3.New(0,0,10)
	--transform.localScale = Vector3.New(1,1,1) 

	return gameObject
end

function BattleSceneLoader.loadFormation()
	local res = ResourceManager.LoadResource("formation")
	local gameObject = UnityEngine.GameObject.Instantiate(res)
	local transform = gameObject:GetComponent(typeof(UnityEngine.Transform))
	transform.localPosition = Vector3.New(0,0,0)
	transform.localScale = Vector3.New(1,1,1)

	return gameObject
end

--[[
function BattleSceneLoader.loadRole(name)
	local res = UnityEngine.Resources.Load(name)
	local gameObject = UnityEngine.GameObject.Instantiate(res)
	local transform = gameObject:GetComponent(typeof(UnityEngine.Transform))
	transform.localPosition = Vector3.New(0,0,0)
	--transform.localScale = Vector3.New(1,1,1)

	return gameObject
end
]]

function BattleSceneLoader.loadRole(name)
	local res = ResourceManager.LoadResource(name)
	local gameObject = UnityEngine.GameObject.Instantiate(res)
	local transform = gameObject:GetComponent(typeof(UnityEngine.Transform))
	transform.localPosition = Vector3.New(0,0,0)

	return gameObject
end


-- 加载不可以实例化的资源,非GameObject类型的引用类型资源,font,audioClip等等
function BattleSceneLoader.loadNoClone(name)
	local res = ResourceManager.LoadResource(name)
    -- GameLog.Error(res)
	return res
end

function BattleSceneLoader.loadUI(name)
	local res = ResourceManager.LoadResource(name)
	local gameObject = UnityEngine.GameObject.Instantiate(res)
	local transform = gameObject:GetComponent(typeof(UnityEngine.Transform))
	transform.localPosition = Vector3.New(0,0,0)
    gameObject.name = name
    --GameLog.Error(res)
    --GameLog.Error(gameObject)
    --GameLog.Error(transform)
	return gameObject
end

return BattleSceneLoader

